package com.oracle.service;

import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: CampusMatching
 * @description:
 * @author: zhaolei
 * @create: 2020-08-04 10:00
 **/
@Service
public class AmpqService {

    @Autowired
    AmqpAdmin amqpAdmin;

    public void setAmqpAdmin() {
        amqpAdmin.declareExchange(new FanoutExchange("bgc.fanout"));
        amqpAdmin.declareQueue(new Queue("bgc.news"));
        amqpAdmin.declareBinding(new Binding("bgc.news",Binding.DestinationType.QUEUE,"bgc.fanout","bgc",null));
    }
}
